package com.tidc.seaserverservice.util;

import com.tidc.seaservermodel.entity.RabbitMessageLog;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ：冯涛滔
 * @date ：Created in 2020/10/24 12:40
 * @description：
 * @modified By：
 * @version:
 */
@Component
public class RabbitUtil {
    @Resource
    private RabbitTemplate rabbitTemplate;
    public void sendMQ(RabbitMessageLog rabbitMessageLog){
        rabbitTemplate.convertAndSend(rabbitMessageLog.getExchange(),rabbitMessageLog.getRouteKey(),rabbitMessageLog,new CorrelationData(rabbitMessageLog.getMsgId()));
    }
}
